package com.wlyuan.open.domain.api.utils;


import com.wlyuan.open.domain.api.valueobj.OpenApiId;
import lombok.extern.slf4j.Slf4j;

import java.util.Optional;

/**
 * @author yuanzheng
 */
@Slf4j
public class MappingOpenApi {
    public OpenApiId createOpenApiId(Long value) {
        return Optional.ofNullable(value)
                .map(OpenApiId::new)
                .orElse(null);
    }

    public Long value(OpenApiId source) {
        return Optional.ofNullable(source).map(s -> s.getId()).orElse(null);
    }
}
